package com.aaa.system.controller;

import com.aaa.common.entity.AclRole;
import com.aaa.common.entity.AclUser;
import com.aaa.common.vo.Result;
import com.aaa.system.service.AclRoleService;
import com.aaa.system.vo.FenRoleVo;
import com.aaa.system.vo.RoleVo;
import com.aaa.system.vo.UserVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ：Mickey
 * @date ：Created in 2022/12/5 20:19
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("/system/role")
@Api(tags = "角色的API接口类")
public class AclRoleController {

    @Autowired
    private AclRoleService roleService;
    @GetMapping("findRoleByUserId/{userid}")
    public Result findRoleByUserId(@PathVariable Long userid){
        return roleService.findRoleByUserId(userid);
    }

    @PostMapping("/fenUserRole")
    public Result fenUserRole(@RequestBody FenRoleVo fenRoleVo){
        System.out.println("fenUserRole+controller");
        return roleService.fenUserRole(fenRoleVo);
    }
    //分页查询所有角色
    @PostMapping("/findRoleByPage/{current}/{pageSize}")
    public Result findRoleByPage(@RequestBody RoleVo roleVo,
                                 @PathVariable Integer current,
                                 @PathVariable Integer pageSize
    ){
        return roleService.findByConditionPage(roleVo,current,pageSize);
    }
}
